import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

//用户登录页面
const Login = () => import('@/views/login/index')

/* Layout */
import Layout from '@/layout'

export default new Router({
  routes: [{
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/404',
      component: () => import('@/views/404'),
      hidden: true
    },
    {
      path: '/update',
      component: Layout,
      redirect: 'noRedirect',
      hidden: true,
      children: [{
        path: 'updatePsw',
        name: 'updatePsw',
        component: () => import('@/views/updatePsw/updatePsw'),
        meta: {
          title: '修改密码',
          icon: 'el-icon-s-data'
        }
      }]
    },
    // {
    //   path: '/',
    //   component: Layout,
    //   redirect: '/noRedirect',
    //   children: [{
    //     path: 'home',
    //     name: 'home',
    //     component: () => import('@/views/home/index'),
    //     meta: {
    //       title: '首页',
    //       icon: 'el-icon-s-data'
    //     }
    //   }]
    // },
    {
      path: '/',
      component: Layout,
      redirect: 'userList',
      alwaysShow: true,
      name: 'userMagage',
      meta: {
        title: '用户管理',
        icon: 'el-icon-user-solid',
        requireAuth: true
      },
      children: [{
          path: 'userList',
          component: () => import('@/views/userManage/userList'),
          name: 'userList',
          meta: {
            title: '用户列表',
            icon: 'el-icon-user',
            requireAuth: true
          }
        },
        {
          path: 'consumeUserList',
          component: () => import('@/views/userManage/consumeUserList'),
          name: 'consumeUserList',
          meta: {
            title: '消费用户',
            icon: 'el-icon-user',
            requireAuth: true
          },
          children: [{
            alwaysShow: false,
            hidden: true,
            keepAlive: true,
            path: 'courseLIstAndIntegralIndex',
            component: () => import('@/views/userManage/courseLIstAndIntegral/index'),
            name: 'courseLIstAndIntegralIndex',
            meta: {
              title: '用户参与信息',
              icon: 'el-icon-coordinate',
              requireAuth: true
            }
          }]

        },
        {
          path: 'vipUserList',
          component: () => import('@/views/userManage/vipUserList'),
          name: 'vipUserList',
          meta: {
            title: '会员用户',
            icon: 'el-icon-user',
            requireAuth: true
          },
          children: [{
            alwaysShow: false,
            hidden: true,
            keepAlive: true,
            path: 'courseLIstAndIntegralIndex',
            component: () => import('@/views/userManage/courseLIstAndIntegral/index'),
            name: 'courseLIstAndIntegralIndex',
            meta: {
              title: '用户参与信息',
              icon: 'el-icon-coordinate',
              requireAuth: true
            }
          }]
        },
        {
          path: 'clue_list',
          component: () => import('@/views/marketingManage/clue/clue_list'),
          name: 'clue_list',
          meta: {
            title: '客户列表',
            icon: 'el-icon-copy-document'
          }
        },
      ]
    },
    {
      path: '/tutorManage',
      component: Layout,
      redirect: 'noRedirect',
      alwaysShow: true,
      name: 'tutorManage',
      meta: {
        title: '导师管理',
        icon: 'el-icon-s-custom'
      },
      children: [{
        path: 'tutorList',
        component: () => import('@/views/tutorManage/tutorList'),
        name: 'clue_list',
        meta: {
          title: '导师列表',
          icon: 'el-icon-coordinate'
        }

      }]
    },
    {
      path: '/courseManage',
      component: Layout,
      redirect: 'noRedirect',
      alwaysShow: true,
      name: 'courseManage',
      meta: {
        title: '课程管理',
        icon: 'el-icon-office-building'
      },
      children: [
        /*{
          path: 'entryForm',
          component: () => import('@/views/courseManage/entryForm'),
          name: 'entryForm',
          meta: {
            title: '报名表',
            icon: 'el-icon-tickets'
          }
        },*/
        {
          path: 'courseList',
          component: () => import('@/views/courseManage/courseList/index'),
          name: 'courseList',
          meta: {
            title: '课程列表',
            icon: 'el-icon-s-check'
          },
          children: [{
              hidden: true,
              path: 'addCourse',
              component: () => import('@/views/courseManage/courseList/index'),
              name: 'addCourse',
              meta: {
                title: '编辑课程',
                icon: 'el-icon-s-check'
              }

            },
            {
              hidden: true,
              path: 'courseDetail',
              component: () => import('@/views/courseManage/courseList/index'),
              name: 'courseDetail',
              meta: {
                title: '课程详细',
                icon: 'el-icon-s-check'
              }

            }
          ]
        },
        {
          path: 'courserType',
          component: () => import('@/views/courseManage/courserType'),
          name: 'courserType',
          meta: {
            title: '课程类型',
            icon: 'el-icon-c-scale-to-original'
          }
        },
        {
          path: 'sign_in',
          component: () => import('@/views/signIn/signIn'),
          name: 'sign_in',
          meta: {
            title: '签到表',
            icon: 'el-icon-s-finance'
          }
        }
      ]
    },
    {
      path: '/orderManage',
      component: Layout,
      redirect: 'noRedirect',
      alwaysShow: true,
      name: 'orderManage',
      meta: {
        title: '订单管理',
        icon: 'el-icon-collection'
      },
      children: [{
        path: 'orderList',
        component: () => import('@/views/orderManage/orderList'),
        name: 'orderList',
        meta: {
          title: '订单列表',
          icon: 'el-icon-money'
        },

      }]
    },
    {
      path: '/personManage',
      component: Layout,
      redirect: 'noRedirect',
      alwaysShow: true,
      name: 'task',
      meta: {
        title: '人员管理',
        icon: 'el-icon-document-copy'
      },
      children: [{
          path: 'personList',
          component: () => import('@/views/personManage/personList'),
          name: 'task_list',
          meta: {
            title: '人员列表',
            icon: 'el-icon-receiving'
          }
        },
        {
          path: 'extension_list',
          component: () => import('@/views/personManage/extension_list'),
          name: 'extension_list',
          hidden: true,
          meta: {
            title: '推广列表',
            icon: 'el-icon-receiving'
          }
      }]
    },
    {
      path: '/marketingManage',
      component: Layout,
      redirect: 'noRedirect',
      alwaysShow: true,
      name: 'marketingManage',
      meta: {
        title: '营销管理',
        icon: 'el-icon-user-solid'
      },
      children: [{
          path: 'coupon',
          component: () => import('@/views/marketingManage/coupon'),
          name: 'coupon',
          meta: {
            title: '优惠劵',
            icon: 'el-icon-s-check'
          }

        },
        {
          path: 'courseCombo',
          component: () => import('@/views/marketingManage/courseCombo/index'),
          name: 'courseCombo',
          meta: {
            title: '课程套餐',
            icon: 'el-icon-potato-strips'
          },
          children: [{
            hidden: true,
            path: 'addCourseCombo',
            component: () => import('@/views/marketingManage/courseCombo/index'),
            name: 'addCourseCombo',
            meta: {
              title: '编辑课程套餐',
              icon: 'el-icon-s-check'
            }
          }]
        },
        {
          path: 'groupActivities',
          component: () => import('@/views/marketingManage/groupActivities/index'),
          name: 'groupActivities',
          meta: {
            title: '拼团活动',
            icon: 'el-icon-potato-strips'
          },
          children: [{
            hidden: true,
            path: 'addGroupActivities',
            component: () => import('@/views/marketingManage/groupActivities/index'),
            name: 'addGroupActivities',
            meta: {
              title: '编辑拼团活动',
              icon: 'el-icon-s-check'
            }
          }]
        },
        // {
        //   path: 'marketingSpread',
        //   component: () => import('@/views/marketingManage/marketingSpread'),
        //   name: 'marketingSpread',
        //   meta: {
        //     title: '营销推广',
        //     icon: 'el-icon-potato-strips'
        //   }
        // },

        {
          path: 'add_clue',
          component: () => import('@/views/marketingManage/clue/add_clue'),
          name: 'add_clue',
          hidden: true,
          meta: {
            title: '设置线索'
          }
        },
        {
          path: 'clue_detail',
          component: () => import('@/views/marketingManage/clue/clue_detail'),
          name: 'clue_detail',
          hidden: true,
          meta: {
            title: '线索详情'
          }
        }
      ]
    },
    {
      path: '/procedureConfig',
      component: Layout,
      redirect: 'noRedirect',
      alwaysShow: true,
      name: 'procedureConfig',
      meta: {
        title: '小程序配置',
        icon: 'el-icon-crop',
        requireAuth: true
      },
      children: [{
          path: 'banner',
          component: () => import('@/views/procedureConfig/banner'),
          name: 'banner',
          meta: {
            title: '轮播图',
            icon: 'el-icon-copy-document',
            requireAuth: true
          }
        },
        {
          path: 'functionBlock',
          component: () => import('@/views/procedureConfig/functionBlock'),
          name: 'functionBlock',
          meta: {
            title: '功能区',
            icon: 'el-icon-s-opportunity',
            requireAuth: true
          }
        },
        // {
        //   path: 'division',
        //   component: () => import('@/views/procedureConfig/division'),
        //   name: 'division',
        //   meta: {
        //     title: '专区',
        //     icon: 'el-icon-c-scale-to-original',
        //     requireAuth:true
        //   }
        // },
        {
          path: 'aboutUs',
          component: () => import('@/views/procedureConfig/aboutUs'),
          name: 'aboutUs',
          meta: {
            title: '关于我们',
            icon: 'el-icon-headset',
            requireAuth: true
          }
        }
      ]
    },
    {
      path: '/system',
      component: Layout,
      redirect: 'noRedirect',
      alwaysShow: true,
      name: 'system',
      meta: {
        title: '系统管理',
        icon: 'el-icon-setting'
      },
      children: [{
          path: 'role_auth',
          component: () => import('@/views/system/role_auth'),
          name: 'role_auth',
          meta: {
            title: '角色权限',
            icon: 'el-icon-s-finance'
          }
        },
        {
          path: 'administrators',
          component: () => import('@/views/system/administrators'),
          name: 'administrators',
          meta: {
            title: '管理员',
            icon: 'el-icon-coordinate'
          }

        }
      ]
    }
    /*,
        {
          path: '/signIn',
          component: Layout,
          redirect: 'noRedirect',
          alwaysShow: true,
          name: 'signIn',
          meta: {
            title: '签到',
            icon: 'el-icon-setting'
          },
          children: [{
            path: 'sign_in',
            component: () => import('@/views/signIn/signIn'),
            name: 'sign_in',
            meta: {
              title: '签到管理',
              icon: 'el-icon-s-finance'
            }
          }]
        }*/
  ]
})
/* {
    path: 'external-link',
    component: Layout,
    children: [{
      path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
      meta: {
        title: 'External Link',
        icon: 'link'
      }
    }]
  }, */

// 404 page must be placed at the end !!!
// {
//   path: '*',
//   redirect: '/404',
//   hidden: true
// }
// ),

// const createRouter = () => new Router({
//   // mode: 'history', // require service support
//   scrollBehavior: () => ({
//     y: 0
//   }),
//   routes: constantRoutes
// })
//
// const router = createRouter()
//
// // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
// export function resetRouter() {
//   const newRouter = createRouter()
//   router.matcher = newRouter.matcher // reset router
// }
//
// export default router
